<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>修改银行卡信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="description" content="网站描述"/>
    <meta name="keywords" content=""/>
    <meta name="author" content="wangl"/>
    <link rel="icon" href="http://ow9lg82yy.bkt.clouddn.com/24f5c360-485d-4a6d-9468-2a61c353cf37.ico">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/static/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
    <style type="text/css">
        .layui-form-item .layui-inline {
            width: 33.333%;
            float: left;
            margin-right: 0;
        }

        @media (max-width: 1240px) {
            .layui-form-item .layui-inline {
                width: 100%;
                float: none;
            }
        }

        .layui-form-item .role-box {
            position: relative;
        }

        .layui-form-item .role-box .jq-role-inline {
            height: 100%;
            overflow: auto;
        }

        /***
        *  ztree 图标变成黄色
        */
        .ztree .line {
            line-height: 0;
            border-top: none;
            float: none;
        }

        .ztree li span.button.ico_docu {
            background-position: -110px 0;
            margin-right: 2px;
            vertical-align: top;
        }

        .multiSelect {
            line-height: normal;
            height: auto;
            padding: 4px 10px;
            overflow: hidden;
            min-height: 38px;
            margin-top: -38px;
            left: 0;
            z-index: 99;
            position: relative;
            background: none;
        }

        .multiSelect a {
            padding: 2px 5px;
            background: #908e8e;
            border-radius: 2px;
            color: #fff;
            display: block;
            line-height: 20px;
            height: 20px;
            margin: 2px 5px 2px 0;
            float: left;
        }

        .multiSelect a span {
            float: left;
        }

        .multiSelect a i {
            float: left;
            display: block;
            margin: 2px 0 0 2px;
            border-radius: 2px;
            width: 8px;
            height: 8px;
            background: url(/static/images/close.png) no-repeat center;
            background-size: 65%;
            padding: 4px;
        }

        .multiSelect a i:hover {
            background-color: #545556;
        }

        .layui-field-box a {
            padding: 2px 5px;
            background: #908e8e;
            border-radius: 2px;
            color: #fff;
            display: block;
            line-height: 20px;
            height: 20px;
            margin: 2px 5px 22px 0;
            float: left;
        }

        .layui-field-box a span {
            float: left;
        }

        .boxadd {
            float: left;
            display: block;
            margin: 2px 0 0 2px;
            border-radius: 2px;
            width: 8px;
            height: 8px;
            background-size: 65%;
            padding: 4px;
        }
    </style>
</head>
<body class="childrenBody">
<form class="layui-form" action="/back/shareholder/saleman/update" method="POST"
      style="width:80%;">

    <input type="hidden" class="layui-input" id="userId" name="userId"  >
    <div class="layui-form-item">
        <label class="layui-form-label">业务员名称</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" id="nickName" name="nickName">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" id="tel" name="tel" >
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">佣金比例</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" id="commRate" name="commRate" placeholder="请输入佣金比例" oninput="checkCommrate()"
                   onkeyup="value=value.replace(/[^\d.]/g,'')"
            >
            <input type="hidden" id="maxCommrate" value="" name="MaxcommRate">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="addBlogArticle">立即提交</button>
            <a class="layui-btn" href="JavaScript:history.back(-1)">点击返回</a>
        </div>
    </div>
</form>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/layui/layui.js"></script>
<script type="text/javascript" src="/static/js/wangEditor.min.js"></script>
<script type="text/javascript" src="/static/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>
</body>
<script>
    var url = location.search;
    var userId = url.split('=')[1];
    $("#userId").val(userId)

    //获取数据
    $.ajax({
        url: "/back/shareholder/partner/edit",
        type: "GET",
        dataType: 'json',
        data:{
            userId:userId
        },
        success: function (baseDto) {
            loadData(baseDto);
        }
    });

    function loadData(baseDto) {
        if (baseDto.code == ERROR)
            console.log(baseDto.msg);
        else {
            var userBank =  baseDto.data;
            //编号
            var idDiv = $("#id");
            idDiv.val(userBank.id);
            //持卡人姓名
            var nickNameDiv = $("#nickName");
            nickNameDiv.val(userBank.nickName);
            //手机号
            var telDiv = $("#tel");
            telDiv.val(userBank.tel);
            //开户行
            var commRateDiv = $("#commRate");
            commRateDiv.val(userBank.commRate);
        }
    }

    function checkCommrate() {
        var upVal = $("input[name='MaxcommRate']").val(); // 最大佣金比例
        var dowmVal = $("input[name='commRate']").val(); // 输入佣金比例
        if(parseFloat(dowmVal)>parseFloat(upVal)){
            layer.msg("佣金比例不能超过"+upVal);
            return false;
        }
        return true;
    }
    function getCommrate(){
        $.ajax({
            async: false,
            url: '/back/shareholder/get/commrate',
            type: 'get',
            success: function (baseDto) {
                var data = baseDto.data
                $("#maxCommrate").val(data.commRate)
            }
        });
    }
    getCommrate()
</script>
</html>